package MyThread_demo;

/**
 * @author ChenYongHao
 * @date 2023/4/28 13:44
 * @desc 实现方式 继承Thread 类
 */
class MyThread extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(getName() + ":" + i);
        }
    }
}

public class MyThread_demo {
    public static void main(String[] args) {
        MyThread my1 = new MyThread();
        MyThread my2 = new MyThread();
        my1.setName("线程一");
        my2.setName("线程二");
        my1.start();
        my2.start();
    }
}
